const fs = require('fs')
const XLSX = require('xlsx')

const workbook = XLSX.read(fs.readFileSync('D:/ext.liudi20/Desktop/功能点.xlsx'), { type: 'buffer' })


workbook.SheetNames.forEach(sheetName => {
    const sheet = workbook.Sheets[sheetName];
    const data = XLSX.utils.sheet_to_json(sheet);
    console.log(`Sheet: ${sheetName}`);
    console.log(data);
});

// 读取功能点
const sheet = workbook.Sheets['Sheet1'];
const data = XLSX.utils.sheet_to_json(sheet);

data.forEach(d => {
    if(d['是否支持嵌入'] == '是') {
        const temp = `allList.add(new FunctionVo(功能点id, "功能点名称", "功能点描述", 是否必选, 功能点类型));`
        const line = temp.replace('功能点id', d['功能点id'])
                .replace('功能点名称',d['功能点名称'])
                .replace('功能点描述',d['功能点描述'])
                .replace('是否必选',d['是否必选'] && d['是否必选']=='是' ? true : false)
                .replace('功能点类型',d['功能点类型'])
        console.log(line)
    }
    
})
